package com.ruoyi.common.enums.business;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

@Getter
@AllArgsConstructor
public enum KocTaskTypeEnum {

    /**
     * 避坑 id一定不要变 id 变了要手动改回来
     */
    GHHD(1L, "1", "参与悦哺的官号活动", "参与悦哺的官号活动（四选二）"),

    TRLX(2L, "2", "推人拉新", "推人拉新"),

    BDBJ(3L, "3", "百度百家号", "百度百家号"),

    TBGG(4L, "4", "淘宝逛逛发布", "淘宝逛逛发布"),

    MLXX(5L, "5", "美丽修行发布", "美丽修行发布"),

    YZSCT(6L, "6", "优质素材图", "优质素材图"),

    BBPFSC(7L, "7", "宝宝皮肤问题素材图", "宝宝皮肤问题素材图"),

    WQFY(8L, "8", "外群发言", "外群发言"),

    NQHY_WH(9L, "9", "内群活跃与维护", "内群活跃与维护"),

    XHS(10L, "10", "小红书", "小红书"),


    ;

    private final Long kocTaskTypeId;

    private final String code;

    private final String name;

    private final String desc;


    private static final Map<Long, KocTaskTypeEnum> ENUM_MAP;

    static {
        KocTaskTypeEnum[] values = values();
        Map<Long, KocTaskTypeEnum> enToCn = new HashMap<>(values.length);
        for (KocTaskTypeEnum value : values) {
            enToCn.put(value.kocTaskTypeId, value);
        }
        ENUM_MAP = Collections.unmodifiableMap(enToCn);
    }

    /**
     * 根据类型查找枚举
     */
    public static KocTaskTypeEnum getEnumByType(Long kocTaskTypeId) {
        KocTaskTypeEnum kocTaskTypeEnum = ENUM_MAP.get(kocTaskTypeId);
        if (ObjectUtil.isEmpty(kocTaskTypeEnum)) {
            throw new RuntimeException("");
        }
        return kocTaskTypeEnum;
    }


}
